#include<iostream>
#include<algorithm>
#include<cstring>
#include<stack>
using namespace std;
int n,num(0),ans(0);
string i[100001];
stack <string> h;
bool Can(string s1,string s2)
{
    if (s1==s2||s1.length()>s2.length())
      return false;
    return s1==s2.substr(0,s1.length());
}
void Make_can(string s)
{
    while (h.size()&&!Can(h.top(),s))
    {
        h.pop();
        num--;
    }
    h.push(s);
    num++;
}
int main()
{
    cin>>n;
    for (int a=1;a<=n;a++)
      cin>>i[a];
    sort(i+1,i+n+1);
    n=unique(i+1,i+n+1)-(i+1);
    for (int a=1;a<=n;a++)
      if (h.empty()||Can(h.top(),i[a]))
      {
          h.push(i[a]);
          ans=max(ans,++num);
      }
      else
        Make_can(i[a]);
    cout<<ans;
    return 0;
}
